home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / magazi~1 / 226 / analog.49 / faxman.doc < prev    next >
Encoding:
Text File  |  1986-10-31  |  7.7 KB  |  123 lines

  1. NOTES ON USING FAX
  2. by Douglas Weir
  3.  
  4.  
  5.  The following comments are supplementary to those contained in the magazine.
  6.  
  7.  FAX is a desk accessory, which means that you should copy it to the disk you
  8. boot from, which contains your other ".ACC" files. FAX works in all three
  9. resolutions. It was developed primarily to be used with "1st_Word" and the
  10. Desktop. Note that ONLY "1st_Word" windows with NO special text styling (e.g.,
  11. italics, underlining, etc.) can be successfully dumped.
  12.  
  13.  The source code files for FAX are included on the disk. The top level is
  14. contained in "fax.c"; the other routines are entered through the code contained
  15. in "fx.c". To play with it, you need a Megamax C compiler. Compile "fax.c",
  16. then "fx.c". Make a library out of the latter, then link "fax.o" with "acc.l"
  17. and the library you created to get "fax.acc". The compiler will give you lots
  18. of warnings about the use of A5 as a base register in the files "f5.ca" -
  19. "f8.ca" when you compile "fx.c", but you can ignore them. The file "fxcomp.h"
  20. contains the settings of certain switches used to compile the present version
  21. of FAX. "TEST_VER" was used to compile an earlier version which was run as a
  22. TOS application with a command line, for testing. "SC_IMAGE" was a version that
  23. saved the entire screen memory before processing instead of one line at a time.
  24. Change the switch settings at your own risk -- it's been a while since I have.
  25.  
  26.  When you select FAX from the Accessory menu a small GEM window will appear and
  27. you will be prompted to enter the "spacing". This is a one-digit number that
  28. specifies the amount of extra scan lines inserted between text lines in the
  29. window you wish to dump. The default spacing is 0, which means that the
  30. application is simply using the spacing supplied by the system and no more.
  31. "1st_Word" does this. Ironically, the GEM Desktop inserts two extra scan lines
  32. between each text line, so the value entered in this case is 2.
  33.  
  34.  The second prompt asks you to enter a "d" for Desktop (if you are dumping a
  35. Desktop window), "1" for "1st_Word", or "l" for Logo. The first two windows are
  36. special cases: not all of the "official" workspace in them is occupied by text.
  37. The Desktop adds a special non-text symbol to the left of subdirectory names
  38. and this portion of the window has to be "trimmed" out of the memory block
  39. inspected by FAX. In the case of "1st_Word" the entire left border is a non-GEM
  40. feature added by the program, while the subtitle area across the top of the
  41. window seems to be handled by application routines and not by GEM -- the
  42. workspace dimensions returned by GEM for a "1st_Word" window include this area,
  43. and they shouldn't. Since there is no way for FAX to learn through system calls
  44. what sort of window it is handling, you have to give it this information.
  45. (Press "return" here for the default setting.)
  46.  
  47.  The spacing and program prompts are kept separate in case you want to try FAX
  48. on text windows generated by some other application that, perhaps, uses
  49. non-standard spacing. Be warned, however, that windows with other non-standard
  50. "features" unknown to FAX will not dump. Text windows using the system font
  51. (and only the system font) in a strictly "legal" GEM format should present no
  52. problems.
  53.  
  54.  The reverse-video character cell in a "1st_Word" or Logo window which
  55. represents the cursor is handled by FAX, but in a slightly erratic way. FAX
  56. "recognizes" characters from their bit-mapped images in screen memory by
  57. hashing the character-cell data and using this as a key to a table. If the
  58. cursor cell hashes to an invalid key then the program will try reversing the
  59. image, but if the cell does happen to yield a good key AND there is no
  60. "collision" with other values hashing to the same key, then FAX will assume
  61. that the default ASCII code for that key is correct. In other words, if you
  62. dump a "1st_Word" or Logo window with the cursor positioned over a character,
  63. you may or may not find the correct character printed out in that position.
  64. This is a flaw in the program's design which will be corrected in a later
  65. version. (For any hackers in the audience, the correction needs to be made in
  66. 'dump_line' in "f8.ca".)However, it is easy to make sure that the cursor is
  67. positioned over blank space when using FAX, even after you have activated the
  68. accessory. Once the two prompts discussed above have been answered, FAX's
  69. window becomes just like any other GEM window -- or almost. You can move it
  70. around, or you can re-activate the window you intend to dump (FAX meanwhile
  71. becomes an inactive window) and make changes to it. When you are ready to
  72. execute the dump you re-activate FAX if necessary and click on the "close" box
  73. to start the dump. Or if you decide to abort, just click on the "full" box.
  74. During the prompts, you can abort by simply pressing the 'x' key.
  75.  
  76.  The reverse-video text lines sometimes used by the Desktop are not a problem,
  77. since FAX forces a redraw of the window it is about to dump and this gets rid
  78. of the highlighting. FAX will work with screens whose colors have been altered
  79. through the Control Panel accessory, and it will work on monochrome screens
  80. that have been "reversed".
  81.  
  82.  When FAX begins execution (after you have closed its window), it hides the
  83. mouse cursor and then starts processing the screen memory, based on what GEM
  84. has told it about the active window and its dimensions. If there is no active
  85. window, FAX simply terminates and restores the mouse cursor. If there is a
  86. delay greater than 2-4 seconds before the dump starts, check to make sure your
  87. printer is switched on. If FAX seems to be taking too long figuring things out
  88. (this could happen if you entered the wrong spacing or didn't tell it about a
  89. "1st_Word" window), you can abort it by pressing any key -- the mouse cursor
  90. should reappear.
  91.  
  92.  In some cases where an application is using an unusual redraw algorithm to
  93. maintain its windows, you may find that the window you want to dump is not
  94. being redrawn properly after you close the FAX window. If this happens, simply
  95. restart FAX and, this time, move it away from the window you want to dump
  96. before you close it.
  97.  
  98.  As mentioned, FAX will dump Logo text windows. The situation with ST-BASIC is
  99. not so simple. The "Command" window will dump with a space setting of 1 (one)
  100. and a carriage return for the second prompt, but only if it is the only window
  101. on the screen. This is due to BASIC's redraw "algorithm". Attempts to dump
  102. other (e.g., "List") windows, even when all other windows were closed, were
  103. unsuccessful.
  104.  
  105.  The actual amount of memory occupied by FAX is a little over 39K bytes. Most
  106. of this is for the GEM windowing routines used for FAX's own window. This part
  107. of FAX is a slightly altered version of "WWX.C" (see the October ST-LOG). There
  108. is one important difference, however. The window has been made small enough so
  109. that its buffer can be declared as a simple 9K-byte array. It seems that just
  110. calling one of the dynamic memory-allocation functions ('calloc()' or
  111. 'malloc()') imposes an incredible memory overhead on a program. I tried calling
  112. 'calloc()' to assign 0 (zero) bytes to a pointer in a desk accessory demo and
  113. found that the active size of the program increased by 44K (!) bytes. Whether
  114. this is a bug just in the Megamax version of these routines or in the
  115. underlying TOS calls I haven't had time yet to find out, but I suspect the
  116. latter. Of course, the only reason one would want to use these calls in an
  117. accessory is to get around an arbitrary segment-size restriction such as
  118. Megamax's, since you can't "de-allocate" such space back to the system when
  119. you're finished with it. Nevertheless, the moral of this story seems to be:
  120. don't do "dynamic" memory allocation in a desk accessory -- it's REALLY
  121. dynamic.
  122.  
  123.